export default {
    namespaced: true,
    state: () => {
        return {
            userInfo: {
                token: 123,
                username: '张三',
            }
        }
    },
    //做同步操作
    mutations: {
        updateName(state, payload) {
            state.userInfo.username = payload
        }
    },
    //做异步操作
    actions: {
        updateNameAsync({ commit }, payload) {
            setTimeout(() => {
                commit('updateName', payload)
            }, 2000)
        }
    },
}